package com.chhh.cranelease.controller;

import com.chhh.cranelease.entity.CarInfo;
import com.chhh.cranelease.entity.CraneBrand;
import com.chhh.cranelease.model.ResponseCode;
import com.chhh.cranelease.service.BaseInfoService;
import com.chhh.cranelease.service.CarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("carinfo/")
public class CarInfoUserController {
    @Autowired
    private CarInfoService service;

    @Autowired
    private BaseInfoService baseInfoService;

    private ResponseCode responseCode = new ResponseCode();
/*
    @RequestMapping("selectAll")
    public MyResponseData selectAll(){
        List<CarInfo> list=service.selectAll();
        MyResponseData responseData=new MyResponseData();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
*/

    @RequestMapping("selectAll1")
    public ResponseCode selectAll1(){
        List<CarInfo> list=service.selectAll1();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll2")
    public ResponseCode selectAll2(){
        List<CarInfo> list=service.selectAll2();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll3")
    public ResponseCode selectAll3(){
        List<CarInfo> list=service.selectAll3();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll4")
    public ResponseCode selectAll4(){
        List<CarInfo> list=service.selectAll4();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll5")
    public ResponseCode selectAll5(){
        List<CarInfo> list=service.selectAll5();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll6")
    public ResponseCode selectAll6(){
        List<CarInfo> list=service.selectAll6();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll7")
    public ResponseCode selectAll7(){
        List<CarInfo> list=service.selectAll7();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    @RequestMapping("selectAll8")
    public ResponseCode selectAll8(){
        List<CarInfo> list=service.selectAll8();
        ResponseCode responseData=new ResponseCode();
        responseData.setErrorCode(0);
        responseData.setStatus("success");
        responseData.setObjectList(list);
        return responseData;
    }
    // 获取id
    @RequestMapping("getModelId")
    public List<CraneBrand> getImage(){
        System.out.println(baseInfoService.getImage());
        return baseInfoService.getImage();
    }
    // 获取图片
    @RequestMapping("getImage")
    public ResponseCode getImages(Integer model_id){
      CraneBrand craneBrands = baseInfoService.getImages(model_id);
      responseCode.setObject(craneBrands);
      return responseCode;
    }
}
